package com.sjtu.form;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * nerine
 * 1/29/2020
 */
@Getter
@Setter
@ToString
public class JobResult {
    @NotBlank
    private String systemId;
    @NotBlank
    private String sequenceId;
    private boolean isSuccess;
    private String failMsg;
    @NotNull
    private Date beginTime;
    @NotNull
    private Date endTime;

    public JobResult(boolean isSuccess, String failMsg) {
        this.isSuccess = isSuccess;
        this.failMsg = failMsg;
    }

    public static JobResult success() {
        return new JobResult(true, null);
    }

    public static JobResult fail(String msg) {
        return new JobResult(false, msg);
    }
}
